<?php

use think\migration\Migrator;
use think\migration\db\Column;

class SupplyQuoted extends Migrator
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
     *
     * The following commands can be used in this method and Phinx will
     * automatically reverse them when rolling back:
     *
     *    createTable
     *    renameTable
     *    addColumn
     *    renameColumn
     *    addIndex
     *    addForeignKey
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function change()
    {
        $table  =  $this->table('supply_quoted',array('engine'=>'InnoDB','collation'=>'utf8_unicode_ci'));
        $table->addColumn('product_id', 'integer',array('limit' => 10,'comment'=>'产品ID'))
            ->addColumn('specs', 'string',array('limit' => 20,'comment'=>'规格')) 
            ->addColumn('price', 'decimal',array('limit' => '(10,2)','comment'=>'价格')) 
            ->addColumn('company_id', 'integer',array('limit' => 11,'comment'=>'厂家ID'))
            ->addColumn('admin_id', 'integer',array('limit' => 11,'default'=>'1','comment'=>'操作者ID'))
            ->addColumn('status', 'boolean',array('limit' => 1,'default'=>'1','comment'=>'状态（0隐藏，1显示）'))
            ->addColumn('create_time', 'integer',array('default'=>0,'comment'=>'创建时间'))
            ->addColumn('update_time', 'integer',array('null'=>true,'comment'=>'修改时间'))
            ->addColumn('delete_time', 'integer',array('null'=>true,'comment'=>'删除时间'))
            ->create();
    }
}
